<!--************************************************************************************************-->
<!-- < Description.php >                                                                           -->
<!-- Copyright (c) 2012-2013 San Yat-sun University School of Software                              -->
<!-- Founder : Tianjiao Li                                                                          -->
<!-- Stu : 10389129                                                                                 -->
<!-- Date: 2012-12-18                                                                               -->
<!-- Destription : Add                                                        -->
<!-- Basic: User:root                                                                               -->
<!--	    Password:                                                                               -->
<!-- Version : 2.1                                                                                  -->
<!-- LastUpdate : 2012-12-23 16:00 BY Tianjiaoli                                                    -->
<!--************************************************************************************************-->

<?php 
	include_once("../db/Description.php");
	class DescriptionManager
	{
		static $instance;
		private $description;
		
		public function __construct()
		{
		}
		
		public static function getInstance()
		{
			if (self::$instance == null)
				self::$instance = new self();
			return self::$instance;
		}
		
		public function insert($array)
		{
			$description = new Description($array);
			$description->insert();
			return true;
		}
		
		public function delete($array)
		{
			$description = new Description($array);
			$description->delete();
		}
		
		public function update($array)
		{
			$description = new Description($array);
			$description->update();
		}
		
		public function getContentlist($type,$N)
		{
			$description = new Description(null);
			
			if ($type === "book")
				return $description->findBookContentlist($N);
			if ($type === "thesis")
				return $description->findThesisContentlist($N);
		}
		
		public function getValueByBookname($bookname)
		{
			$description = new Description(null);
			return $description->findValueByBookname($bookname);
		}
		
		public function getValueByThesisname($Thesisname)
		{
			$description = new Description(null);
			return $description->findValueByThesisname($Thesisname);
		}
		
		public function getValueByContent($content)
		{
			$description = new Description(null);
			return $description->findValueByContent($content);
		}
		
		public function getNBooksByDescription($content, $N){
			$description = new Description(null);
			return $description->findNBooksByDescription($content, $N);
		}
		
		public function getNThesesByDescription($content, $N){
			$description = new Description(null);
			return $description->findNThesesByDescription($content, $N);
		}
	}
?>